home *** CD-ROM | disk | FTP | other *** search
- property pDanceLoops, pCharCode, pName, pCharInfo, pImpatience, pLikesGender, pHasEverOrdered, pIntoxication, pDrinkTicket, pOver21, pBirthdate, pBirthDate2, pAlreadyCarded, pExpirationDate, pExpirationDate2, pCharmed, pBouncedPermanently, pNumVisits, pNumDrinks, pBuzzMin, pBlottoMin, pPassedOutMin, pTotalAlcohol, pFlashLabels, pFlashCharMember, pFlashMouthMember, pCharacterActions, pFavoriteSong, pHatedSong, pFirstAppearance, pVOpath
- global debug
-
- on bounced me
- global gImplementedCharacters
- if pAlreadyCarded and not pOver21 then
- pBouncedPermanently = 1
- end if
- end
-
- on mReinitialize me
- global gImplementedCharacters
- pCharacterActions = getCharActions(pCharCode)
- pCharInfo = gImplementedCharacters[pCharCode]
- pName = pCharInfo[#DISPLAY_NAME]
- pImpatience = pCharInfo[#IMPATIENCE]
- pFirstAppearance = pCharInfo[#MINLEVEL]
- pFlashCharMember = flashMember(pCharCode)
- pFlashMouthMember = flashMouthMember(pCharCode)
- pVOpath = setVOPath(pCharCode)
- end
-
- on new me, charCode
- global gSongList, gForceUnderage
- pFavoriteSong = random(count(gSongList))
- pHatedSong = pFavoriteSong
- repeat while pHatedSong = pFavoriteSong
- pHatedSong = random(count(gSongList))
- end repeat
- pCharCode = charCode
- mReinitialize(me)
- pBouncedPermanently = 0
- pLikesGender = randomFromWeightedList(pCharInfo[#SexPref], [#male, #female, #bi])
- pAlreadyCarded = 0
- pDrinkTicket = 0
- pCharmed = 0
- pNumVisits = 0
- pNumDrinks = 0
- pTotalAlcohol = 0
- pBuzzMin = pCharInfo[#BUZZMIN]
- pBlottoMin = pCharInfo[#BLOTTOMIN]
- pPassedOutMin = pCharInfo[#POUTMIN]
- pFlashLabels = VOID
- pIntoxication = #sober
- ageFactor = pCharInfo[#UF]
- if (ageFactor = 0) or inRecipeMode() then
- pOver21 = 1
- ageInYears = pCharInfo[#UY]
- if ageInYears = 0 then
- ageInYears = 100
- end if
- else
- if (random(ageFactor) > 1) and not gForceUnderage then
- pOver21 = 1
- ageInYears = random(5) + 20
- else
- pOver21 = 0
- ageInYears = pCharInfo[#UY]
- ageInYears = ageInYears + random(10) - 9
- end if
- end if
- currentYear = systemDate().year
- currentMonth = systemDate().month
- currentDay = systemDate().day
- pExpirationDate = randomDateInFuture()
- pExpirationDate2 = randomDateInFuture()
- if pOver21 then
- year = currentYear - max(22, ageInYears + 1)
- pBirthdate = date(year, random(12), random(31))
- pBirthDate2 = date(year - random(2) + 1, random(12), random(31))
- else
- year = currentYear - 17 - random(3)
- pBirthdate = date(year, random(12), random(31))
- pBirthDate2 = date(year + random(2) - 1, random(12), random(31))
- end if
- if checkAge(systemDate(), pBirthdate, 21) <> pOver21 then
- debugAlert("Error in date calculation" && pBirthdate)
- end if
- if checkAge(systemDate(), pBirthDate2, 21) <> pOver21 then
- debugAlert("Error in date calculation" && pBirthDate2)
- end if
- return me
- end
-
- on incrementDrinks me
- pNumDrinks = pNumDrinks + 1
- end
-
- on incrementAlcohol me, newBooze
- pTotalAlcohol = pTotalAlcohol + newBooze
- end
-
- on incrementNumVisits me
- pNumVisits = pNumVisits + 1
- end
-
- on approachAndGreet me
- global gPearlyGates
- if pNumVisits > 1 then
- greet = #GREETB
- else
- greet = #GREETA
- end if
- if gPearlyGates and (pCharCode = #BC) then
- playAnim(me, [#approach, #greetC], [#approaching, #greeting], [#arriveDone, #heavenGreetDone])
- else
- playAnim(me, [#approach, greet], [#approaching, #greeting], [#arriveDone, #greetDone])
- end if
- end
-
- on musicCheck me
- global gCurrentSong, gSongList
- if not busy(me) then
- if pFavoriteSong = gCurrentSong then
- pDanceLoops = 0
- playAnim(me, #dance)
- end if
- end if
- end
-
- on resetIntoxication me
- getIntoxication(me)
- if pIntoxication = #passedOut then
- mSoberUp(me, 5)
- getIntoxication(me)
- end if
- end
-
- on mSoberUp me, amountToSober
- if voidp(amountToSober) then
- amountToSober = currentLevel(#SOBERUP)
- end if
- pTotalAlcohol = max(0, pTotalAlcohol - amountToSober)
- end
-
- on getIntoxication me
- global gGameSetup, gGameLevel
- if pTotalAlcohol > pPassedOutMin then
- pIntoxication = #passedOut
- else
- if pTotalAlcohol > pBlottoMin then
- pIntoxication = #blotto
- else
- if pTotalAlcohol > pBuzzMin then
- pIntoxication = #buzzed
- else
- pIntoxication = #sober
- end if
- end if
- end if
- return pIntoxication
- end
-
- on nextGlassMember me, glassPosition
- global gBarTopManager
- mySlot = SpriteToBarSlot(me.spriteNum)
- glassType = getBarTopGlass(gBarTopManager, mySlot)
- if glassType = #beer then
- if pCharCode = #SM then
- contents = barSlotToGlassSprite(gBarTopManager, mySlot).pContents
- if contents[#limetwist] or contents[#lemontwist] then
- return "SM_PEN_" & glassPosition
- end if
- end if
- end if
- return pCharCode & "_" & glassPrefix(glassType) & "_" & glassPosition
- end
-
- on nextHandMember me, glassPosition
- return pCharCode & "_" & "hand" & "_" & glassPosition
- end
-
- on setFlashLabels me, flashSprite, testMe
- if voidp(pFlashLabels) then
- pFlashLabels = getFlashLabels(me, flashSprite, testMe)
- end if
- return pFlashLabels
- end
-
- on getFlashLabels me, flashSprite, testMe
- flashSprite = sprite(flashSprite)
- memberNum = flashSprite.member
- frameCount = memberNum.frameCount
- labelList = []
- repeat with X = 1 to frameCount
- thisLabel = getFrameLabel(flashSprite, X)
- if thisLabel <> EMPTY then
- add(labelList, [#label: thisLabel, #start: X, #end: X, #mid: []])
- previous = labelList[labelList.count]
- repeat with Y = X + 1 to frameCount
- thisLabel = getFrameLabel(flashSprite, Y)
- if thisLabel <> EMPTY then
- if thisLabel starts "End" then
- previous[#end] = Y
- exit repeat
- next repeat
- end if
- add(previous[#mid], [#label: thisLabel, #start: Y])
- end if
- end repeat
- X = Y
- end if
- end repeat
- if debug then
- testAgainst = ["APPROACH", "BECKON", "PCHARM", "NCHARM", "XNCHARM", "XPCHARM", "NDRINK", "DRINK", "PDRINK", "ANTIC1", "ANTIC2", "ANTIC3", "DANCE", "RETREAT", "BASE1", "BOUNCE", "SBUZZ", "SBLOTTO", "SMOVE", "POUT", "FLATTER", "TBASE", "TLEFT", "TRIGHT"]
- put "Name:" && memberNum.fileName
- put "Name:" && memberNum.name
- put "Frames:" && frameCount
- put "Character" && pCharCode
- repeat with mine in labelList
- put "This label" && mine
- if getOne(testAgainst, mine[#label]) = 0 then
- put mine[#label] && "not found in test list"
- end if
- end repeat
- put count(labelList)
- repeat with whatever in testAgainst
- foundit = 0
- repeat with mine in labelList
- if mine[#label] = whatever then
- foundit = 1
- exit repeat
- end if
- end repeat
- if not foundit then
- put whatever && "not found in this character's file"
- end if
- end repeat
- end if
- return labelList
- end
-
- on checkCharActions me
- if (pCharacterActions = [:]) or voidp(pCharacterActions) then
- else
- repeat with X = 1 to count(pCharacterActions)
- Current = string(getPropAt(pCharacterActions, X)) && pCharacterActions[X]
- if voidp(pCharacterActions[X][1]) then
- put "*********************** WARNING ***********************" && Current
- put "Problem with" && Current && "for character" && pCharCode
- next repeat
- end if
- end repeat
- repeat with verify in [#ABLOTTO, #ABUZZ, #approach, #ASOBER, #base1, #tbase, #beckon, #bounce, #CARDEXCUSE, #CARDGEN, #CARDNEG, #dance, #drink, #DRINKD, #DRINKS, #DRINKDD, #flatter, #GREETA, #GREETB, #nCharm, #NDRINKD, #NDRINKS, #NDRINKZ, #passOut, #PCharm, #PDRINKD, #PDRINKS, #retreat, #TICKET, #WDRINKD, #WDRINKS, #WDRINKZ, #WORDERD, #WORDERS, #WORDERZ, #XNCHARM, #XPCHARM, #tLeft, #tRight]
- found = 0
- repeat with X = 1 to count(pCharacterActions)
- if getPropAt(pCharacterActions, X) = verify then
- found = 1
- exit repeat
- end if
- end repeat
- if not found then
- next repeat
- end if
- end repeat
- repeat with X = 1 to count(pCharacterActions)
- if pCharacterActions[X][1] = [#anim: "BASE1"] then
- prop = getPropAt(pCharacterActions, X)
- if prop <> #base1 then
- end if
- end if
- end repeat
- end if
- end
-